@import 'light.scss';
@import 'dark.scss';

.glarity--container {
  position: relative;
  z-index: 1;
  margin-bottom: 30px;
  flex-basis: 0;
  flex-grow: 1;
  z-index: 1;
  box-sizing: border-box;
  width: var(--rhs-width);
  min-width: var(--rhs-width);
  max-width: 100%;
  pointer-events: all;

  &.glarity--chatgpt--youtube {
    width: var(--ytd-watch-flexy-sidebar-width);
    min-width: var(--ytd-watch-flexy-sidebar-min-width);
  }

  &.glarity--full-container {
    min-width: calc(100% - var(--rhs-margin));
    margin-right: var(--rhs-margin);
    margin-bottom: 10px;
  }
  &.glarity--chatgpt--pubmed {
    width: calc(100% + 80px);
    max-width: calc(100% + 80px);
  }

  .glarity--link {
    cursor: pointer;
    color: #065fd4;

    a:hover {
      text-decoration: underline;
    }
  }

  .glarity--chatgpt {
    border: 1px solid;
    border-radius: 8px;
    padding: 6px 10px 0;
    line-height: 1.5;
    word-wrap: break-word;
    // word-break:break-all;
  }

  &.sidebar--free {
    margin-left: 30px;
    height: fit-content;
  }

  p {
    margin: 0;
  }

  a.gpt-promotion-link {
    &:hover {
      text-decoration: none;
    }
    a:visited {
      color: inherit;
    }
  }

  .icon-and-text {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  #gpt-answer.markdown-body.gpt-markdown {
    font-size: 14px;
    line-height: 1.5;

    pre {
      margin-top: 10px;
    }

    & > p:not(:last-child) {
      margin-bottom: 10px;
    }

    pre code {
      white-space: pre-wrap;
      word-break: break-all;
    }

    pre code.hljs {
      padding: 0;
      background-color: transparent;
    }

    ol li {
      list-style: disc;
    }

    img {
      width: 100%;
    }

    a {
      text-decoration: underline;
      &:visited {
        color: unset;
      }
    }

    .glarity--chatgpt--header {
      margin-top: -42px !important;
    }
  }

  .glarity--chatgpt--header {
    margin-top: -42px !important;
    margin-left: calc(100% - 58px);
    margin-bottom: 10px;
    padding-bottom: 6px;
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;

    gap: 5px;

    .gpt--feedback {
      margin-left: auto;
      display: flex;
      gap: 6px;
      cursor: pointer;
    }

    .gpt--feedback--selected {
      color: #ff6347;
    }
  }
}

.glarity--summary--highlight {
  color: red;
}
.glarity--header {
  // position: relative;
  // z-index: 10;
  display: flex;
  padding: 2px 0 10px;
  justify-content: space-between;
  align-items: center;
  font-size: 16px;
  user-select: none;
  cursor: pointer;
}

a.glarity--header__logo,
span.glarity--header__logo {
  margin-right: 6px;
  height: 20px;
  color: #000;
  text-decoration: none;
  line-height: 20px;

  &:visited {
    color: #000;
  }

  img {
    margin-right: 5px;
    width: 20px;
    height: 20px;
    vertical-align: middle;
  }
}

span.glarity--header__logo {
  cursor: default;
}

.glarity--main {
  position: relative;
  margin-left: -10px;
  margin-right: -10px;
  padding: 0 12px;
  border-top: 1px solid rgb(221, 221, 221);
}
.glarity--main__header {
  position: relative;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  text-align: left;
  font-size: 14px;
  border-bottom: 1px solid rgb(221, 221, 223);

  a {
    color: #333;
  }
}
.glarity--main__header--title {
  font-weight: bold;
  cursor: pointer;
}

.glarity--main__header--icon {
  cursor: pointer;
}

.glarity--main__header--action {
  a {
    display: inline-block;
    margin-left: 5px;
  }
}

.glarity--main__container {
  position: relative;
  z-index: 30;
  padding: 10px 0 10px;
  font-size: 14px;
  color: #444;

  &.glarity--main__container--subtitle {
    margin-right: -10px;
    padding-right: 10px;
    height: 200px;
    max-height: 200px;
    overflow: hidden;
    overflow-y: auto;
  }

  .glarity--chatgpt--content {
    margin-right: -10px;
    padding-right: 10px;
    max-height: 260px;
    height: 260px;
    overflow: hidden;
    overflow-y: auto;
  }
}
.glarity--main__loading {
  position: absolute;
  z-index: 99;
  width: 100%;
  height: calc(100% - 16px);
  background-color: rgb(249, 249, 249);
}

.glarity--subtitle {
  display: flex;
  justify-content: left;
  align-items: baseline;
  grid-template-columns: auto auto;
  gap: 0px;
  margin: 0px 0px 16px;

  .subtitle--time {
    padding-right: 10px;
    color: var(--yt-spec-call-to-action);
    background-color: var(--yt-spec-suggested-action);
    padding: 0 4px;
    font-size: 1.3rem;
    font-weight: 500;
    line-height: 1.8rem;
    cursor: pointer;
  }
  .subtitle--text {
    padding-left: 10px;
    padding-right: 10px;
  }
}

.glarity--select {
  width: 70px;
  border: 1px solid #bbb;
  border-radius: 4px;
}

.glarity--icon--loading {
  display: inline-block !important;
  vertical-align: middle;
  transform: scale(0.7);
}

.glarity--text-xs {
  font-size: 12px;
  line-height: 1.6;
}
.glarity--mt-2 {
  margin-top: 10px;
}

// glarity--chatgpt--tips
.glarity--chatgpt--tips {
  position: fixed;
  z-index: 100;
  right: 20px;
  top: 20px;
  width: 300px;

  button.btn.glarity--chatgpt--tips--close {
    position: absolute !important;
    z-index: 100;
    right: 5px;
    top: 5px;
    padding: 0;
    height: auto;
    border: none;
    background-color: transparent;
  }
}

// newspicks
.glarity--chatgpt--newspicks {
  margin-bottom: 32px;
  background-color: #fff;
  border: none;
  border-radius: 0;
  box-shadow: 0 1px 4px #ddd;

  .glarity--chatgpt {
    border: none;
    background: #fff;
    border-radius: 0;

    .glarity--main__container {
      a {
        color: #337ab7;

        &:hover {
          text-decoration: underline;
        }
      }
    }
  }
}

.glarity--geist--select {
  position: relative;
}

// nikkei
.glarity--chatgpt--nikkei {
  flex-grow: inherit;
}

// google partents
.glarity--chatgpt--googlePatents {
  margin-bottom: 0;

  .glarity--chatgpt {
    border: none;
    border-radius: 0;
  }
}

// bing
.glarity--chatgpt--bing {
  margin-left: -20px;
  margin-right: -20px;
}

// Web Summary
.glarity--summary {
  position: fixed;
  top: 160px;
  right: 15px;
  width: auto;
  z-index: 99999999999999;

  .glarity--card {
    width: 360px;
  }
}

// Bilibili
.glarity--chatgpt--bilibili {
  margin-top: 20px;
  margin-bottom: 20px;

  .glarity--chatgpt {
    border-radius: 6px;
    border: none;

    .glarity--main {
      border-top-color: var(--line_regular);
    }
  }
}

@media screen and (max-width: 600px) {
  .glarity--summary {
    .glarity--card {
      width: calc(100vw - 30px);
    }
  }
}
